#include"StdAfx.h"

pgVec3::pgVec3()
{
	x = 0.0f;
	y = 0.0f;
	z = 0.0f;
}

pgVec3::pgVec3(float fX, float fY, float fZ)
{
	x = fX;
	y = fY;
	z = fZ;
}

pgVec3::pgVec3(int nX, int nY, int nZ)
{
	x = (float)nX;
	y = (float)nY;
	z = (float)nZ;
}

pgVec3::pgVec3(const XMVECTOR &v)
{
	x = XMVectorGetX(v);
	y = XMVectorGetY(v);
	z = XMVectorGetZ(v);
}

pgVec3::~pgVec3()
{
}


float pgVec3::Dot(const pgVec3 &v1)
{
	return x * v1.x +
		y * v1.y +
		z * v1.z;
}

float pgVec3::Length()
{
	return sqrtf(LengthSquared());
}

float pgVec3::LengthSquared()
{
	return x * x +
			y * y +
			z * z;
}

pgVec3 pgVec3::Normalize()
{
	float len = Length();
	return pgVec3(x / len, y / len, z / len);
}